package com.xc.stock.constant;

/**
 * 
 * title: RoleEnum.java 
 * 角色枚举
 * 
 * @author rplees
 * @email rplees.i.ly@gmail.com
 * @version 1.0  
 * @created Jan 13, 2021 11:53:14 AM
 */
public enum RoleEnum {
	UNKNOWN("UNKNOWN", "未知"),
	BUSINESS("BUSINESS", "商家"),
	USER("USER", "用户"), 
	SYS("SYS", "平台"),
	AGENT("AGENT", "代理"),
	;
	
	String code;
	String remark;
	
	RoleEnum(String code, String remark) {
		this.code = code;
		this.remark = remark;
	}
	
	public String code() {
		return code;
	}
	
	public String remark() {
		return remark;
	}
	
	public static String remark(String c) {
		RoleEnum of = of(c);
		return of == null ? "" : of.remark;
	}
	
	public static RoleEnum of(String c) {
		RoleEnum[] enums = RoleEnum.values();
		for (RoleEnum e : enums) {
			if(e.code.equals(c)) {
				return e;
			}
		}

		return UNKNOWN;
	}
}
